package com.hadoop.mr.amiudake.flow;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Partitioner;

public class FlowPartitioner extends Partitioner<Text, FlowBean>{

	@Override
	public int getPartition(Text key, FlowBean value, int numPartitions) {
		String area = value.getArea();
		int patritionsNum = 3;
		switch (area) {
		case "sh":
			patritionsNum = 0;
			break;
		case "bj":
			patritionsNum = 1;
			break;
		default:
			patritionsNum = 2;
			break;
		}
		System.out.println(patritionsNum);
		return patritionsNum;
	}
	
}
